<div class="bg-light lter b-b wrapper-md">
	<h1 class="m-n font-thin h3" translate="device.management"></h1>
</div>
<div class="wrapper-md" ng-controller="DeviceAddOrUpdateCtrl">
	<div class="panel panel-default">
		<!--面板标题-->
		<div class="panel-heading font-bold" translate="{{vm.title}}"></div>
		<div class="panel-body">
			<ng-form name="AddEditForm" class="form-horizontal form-validation">
			<div class="form-group ">
				<div class="col-sm-6">
					<label class="col-lg-3 control-label"> <span
						class="text-danger">*</span> <span translate="device.snCode"></span>
					</label>
					<div class="col-lg-8">
						<input class="form-control" name="deviceCoding" id="deviceCoding"
							ng-model="vm.device.deviceCoding"
							required uib-tooltip="{{app.getMessage('common.op.remind2')}}"
							maxlength="32" />
					</div>
				</div>
				<div class="col-sm-6">
					<label class="col-lg-3 control-label"> <span
						class="text-danger">*</span> <span translate="device.name"></span>
					</label>
					<div class="col-lg-8">
						<input class="form-control" name="deviceName" id="deviceName"
							maxlength="32" ng-model="vm.device.deviceName" required
							uib-tooltip="{{'common.op.remind2' | translate}}" />
						<!--  ng-pattern="app.reg.account" -->
					</div>
				</div>
			</div>
			<div class="form-group ">
				<div class="col-sm-6">
					<label class="col-lg-3 control-label"> <span
						class="text-danger">*</span> <span translate="device.deviceType"></span>
					</label>
					<div class="col-lg-8">						
						<select class="input form-control inline v-middle" ng-disabled="{{vm.disabled}}"
							name="deviceType" ng-model="vm.device.deviceType"
							convert-to-number readonly>
							<option value="" translate="common.select"></option>
							<option value="0" translate="device.deviceType.PM10"></option>
							<option value="1" translate="device.deviceType.monitor"></option><!-- ng-if="vm.show" -->
						</select>
					</div>
				</div>
				<div class="col-sm-6">
					<label class="col-lg-3 control-label"> <span
						class="text-danger">*</span> <span translate="device.installTime"></span>
					</label>
					<div class="col-lg-8">
						<div class="input-group">
							<input id="installTime" required class="form-control"
								style="background: white;" ng-model="vm.device.installTime"
								readonly placeholder={{'device.installTime'|translate}} 
                                   	name="installTime">
							<span class="input-group-btn ">
								<button type="button" class="btn btn-default"
									wdate-picker="{el:'installTime',dateFmt:'yyyy-MM-dd HH:mm:ss',getDateStr:'yyyy-MM-dd HH:mm:ss'}"
									ng-model="vm.device.installTime">
									<i class="glyphicon glyphicon-calendar"></i>
								</button>
							</span>
						</div>
					</div>
				</div>
			</div>
			<div class="form-group ">
				<div class="col-sm-6">
					<label class="col-lg-3 control-label"> <span
						class="text-danger">*</span> <span
						translate="device.deviceLocation"></span>
					</label>
					<div class="col-lg-8">
						<select class="input form-control inline v-middle"
							name="deviceLocation" readonly ng-model="vm.device.arch.id"
							convert-to-number required>
							<!--ng-click="vm.getArch()"  -->
							<option ng-repeat="x in vm.archs" value="{{x.id}}">{{x.name}}</option>
						</select>
					</div>
				</div>
				<div class="col-sm-6">
					<label class="col-lg-3 control-label"> <span
						class="text-danger">*</span> <span translate="device.deviceStatus"></span>
					</label>
					<div class="col-lg-8">
						<select class="input form-control inline v-middle"
							name="deviceStatus" readonly ng-model="vm.device.deviceStatus"
							convert-to-number required>
							<option value="0" translate="vs.monitorRecord.online"></option>
							<option value="1" translate="vs.monitorRecord.offline"></option>
							<option value="2" translate="vs.monitorRecord.fault"></option>
						</select>
					</div>
				</div>
			</div>
			<div class="form-group ">
				<!--经纬度 -->
				<div class="col-sm-6">
					<label class="col-md-3 control-label"> <span
						class="text-danger">*</span> <span translate="common.longitude"></span>
					</label>
					<div class="col-md-8">
						<div class="input-group">

							<input type="text" name="name" class="form-control"
								ng-model="vm.device.longitude" id="updateDeviceLongitude"
								required readonly placeholder="-180 ~ 180"
								ui-validate="{a:'$value == undefined || $value >= -180', b:'$value == undefined || $value <= 180', c: 'app.reg.checkNumber($value, 3, 6)'}" />
							<span class="input-group-btn"> <map-select
                                    on-select="vm.location" is-multi="single"></map-select>
							</span>
						</div>
					</div>
				</div>
				<div class="col-sm-6">
					<label class="col-md-3 control-label"> <span
						class="text-danger">*</span> <span translate="common.latitude"></span>
					</label>
					<div class="col-md-8">
						<!--<div class="input-group">-->
						<input type="text" name="number" class="form-control"
							ng-model="vm.device.latitude" id="updateDeviceLatitude" required
							readonly placeholder="-90 ~ 90"
							ui-validate="{a:'$value == undefined || $value >= -90', b:'$value == undefined || $value <= 90', c: 'app.reg.checkNumber($value, 2, 6)'}" />
					</div>
				</div>
			</div>
				<div class="form-group " ng-if="vm.device.deviceType === 1">
					<div class="col-sm-6">
						<label class="col-lg-3 control-label"> <span
								class="text-danger">*</span> <span
								translate="device.cameraType"></span>
						</label>
						<div class="col-lg-8">
							<select class="input form-control inline v-middle"
									name="cameraType" ng-model="vm.device.cameraType"
									convert-to-number required>
								<option ng-repeat="x in vm.cameraTypeList" value="{{x.value}}">{{x.content}}</option>
							</select>
						</div>
					</div>
				</div>
			</ng-form>
		</div>


		<footer class="panel-footer text-right bg-light lter">
			<button type="button" class="btn btn-default" ng-click="vm.cancel()"
				translate="common.cancel"></button>
			<button type="button" class="btn btn-primary" ng-click="vm.save()"
				ng-disabled="AddEditForm.$invalid" translate="common.confirm"></button>
		</footer>
	</div>
</div>